<?php

class Product_provider_model extends MY_Model {

    function __construct() {
        parent::__construct();
        $this->table = 'product_provider';
    }
    function getAllProductProvier($product_id) {
        $this->db->select('c.*,p.provider_name' );
        $this->db->from( $this->table .' as c');
        $this->db->join( 'provider as p', 'p.id = c.provider_id' );
        $query = $this->db->get();
        return $query->result();
    }
    function deleteRowsByProduct($product_id){
    	if ($product_id != NULL) {
    		$this->db->where('product_id', $product_id);
    		$this->db->delete($this->table);
    		return $this->db->affected_rows();
    	}
    }
}

?>